'use strict'
const path = require('path')
const moment = require('moment')

const currentTime = moment().format('YYYY-MM-DD HH:mm:ss');
const INFO = `[${currentTime}] [INFO]  -  `;

const service = require('./service');
console.log(service)
console.log(INFO + __filename)

module.exports = {
  /**
   * 开发环境
   */
  dev: {
    assetsSubDirectory: 'static',
    assetsPublicPath: '/',
    proxyTable: {...service},
    // https://www.cnblogs.com/momeak/p/10563833.html
    // 跨域代理
    // proxyTable: {
    //   "/apiProxy": { 
    //     "target": 'https://www.zhangcs.cn/api/', 
    //     // "target": 'http://127.0.0.1:70/api/', 
    //     "changeOrigin": true, 
    //     "pathRewrite": {   
    //       '^/apiProxy': ''
    //     }
    //   },
    // },

    
    // host: '127.0.0.1', 
    host: 'localhost',
    port: 8080, 
    autoOpenBrowser: false,
    errorOverlay: true,
    notifyOnErrors: true,
    poll: false, 
    
    /**
     * Source Maps
     */
    devtool: 'cheap-module-eval-source-map',

    cacheBusting: true,

    cssSourceMap: true
  },

  /**
   * production 环境
   */
  build: {
    index: path.resolve(__dirname, '../dist/index.html'),

    // Paths
    assetsRoot: path.resolve(__dirname, '../dist'),
    assetsSubDirectory: 'static',
    assetsPublicPath: './',

    /**
     * Source Maps
     */

    productionSourceMap: false,	// 打包是否生成.map文件
    devtool: '#source-map',

    productionGzip: false,
    productionGzipExtensions: ['js', 'css'],

    bundleAnalyzerReport: process.env.npm_config_report
  }
}
